package multiThread;

// create multi thread in java
// two ways:	1. extends Thread class
//				2. implements Runnable interface

// CREATE MULTI THREAD IN JAVA : IMPLEMENTS RUNNABLE INTERFACE

class Ar implements Runnable {
	public void run() {
		for (int i = 0; i < 30; i++)
			System.out.println("I = " + i);
	}
}

class Br implements Runnable {
	public void run() {
		for (int i = 0; i < 20; i++)
			System.out.println("J = " + i);
	}
}

public class MyThread3 {
	public static void main(String args[]) {
		Ar obj1 = new Ar();
		Br obj2 = new Br();
		Thread t1 = new Thread(obj1);
		Thread t2 = new Thread(obj2);
		t1.start();
		t2.start();
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
		}
		t1.start();
	}
}